using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.IO;

namespace BitmapToIcon
{
    class Program
    {
        static void Main(string[] args)
        {
            Icon icon = Icon.ExtractAssociatedIcon(args[0]);
            FileStream iconFile = File.OpenWrite(Path.ChangeExtension(args[0], ".ico"));
            icon.Save(iconFile);
        }
    }
}
